#@web_layout?()
#define css()
<link rel="stylesheet" type="text/css" href="#(contextPath)/assets/front/web/css/main.css?#(getUUID())" />
<link rel="stylesheet" type="text/css" href="#(contextPath)/assets/front/web/css/layer.css?#(getUUID())" />
<link rel="stylesheet" type="text/css" href="#(contextPath)/assets/admin/js/fancybox/source/jquery.fancybox.css?v=2.1.2" />
<link rel="stylesheet" type="text/css" href="#(contextPath)/assets/front/web/css/laypage.css?#(getUUID())" />
<style>
	.avatar{
		height:50px;
		width:50px;
		margin:0 auto;
		border-radius: 100%;
		background: url("/assets/front/web/resources/head1.png") center center no-repeat; 
	}
</style>
#end
#define content()
<div class="c-article" style="min-height:100%">
    <div class="g-task-success">
        <div class="g-task-success-info">
            <div class="m-task-card">
                <div class="u-task-icon"></div>
                <div class="u-task-text">恭喜您成功创建任务!</div>
            </div>
            <div class="m-task-card-column" style="margin-top:30px;padding:35px;">
                <div class="u-title">基本信息</div>
              #if(isShowQrCode.type!="TASK_OFFLINE")
                <ul class="m-task-list">
                 
                    <li class="m-task-cell">
                        <div class="u-task-key">任务标题:</div>
                        <div class="u-task-value">#(task.task_title)</div>
                    </li>
                    <li class="m-task-cell">
                        <div class="u-task-key">任务时间:</div>
                        <div class="u-task-value">#(task.dateString)</div>
                    </li>
                    #--
                    <li class="m-task-cell">
                        <div class="u-task-key">任务酬劳:</div>
                        <div class="u-task-value">#(task.task_price)元/人</div>
                    </li>
                    <li class="m-task-cell">
                        <div class="u-task-key">任务人数:</div>
                        <div class="u-task-value">#(task.wh_number)人</div>
                    </li>
                    --#
                    <li class="m-task-cell">
                        <div class="u-task-key">推广类型:</div>
                        <div class="u-task-value">#(task.type())</div>
                    </li>
                    <li class="m-task-cell">
                        <div class="u-task-key">预计花费:</div>
                        <div class="u-task-value">
                        	#if(task.extension_type==1)
                        		#(task.total_fee+task.wh_number*50)元(指定主播#(task.wh_number)人，额外收取#(task.wh_number*50)元)
                        	#else
                        		#(task.total_fee)元	
                        	#end
                        </div>
                    </li>
                    <li class="m-task-cell">
                        <div class="u-task-key">任务状态:</div>
                        <div class="u-task-value">#(task.status())</div>
                    </li>
                    #if(task.h5_type==2)
	                    <li class="m-task-cell">
	                        <div class="u-task-key">任务链接:</div>
	                        <div class="u-task-value">
	                        	<a href="#(contextPath)/platform/mission?id=#(task.id)" target="_blank">
	                        	http://www.ele-young.com/platform/mission?id=#(task.id)</a>
	                        </div>
	                    </li>
                    #end
                    <li class="m-task-cell">
                        <div class="u-task-key">推广方式:</div>
                        <div class="u-task-value">#(task.task_type==1?"线上":"线下")</div>
                    </li>
                    <li class="m-task-cell">
                        <div class="u-task-key">是否有H5页面:</div>
                        <div class="u-task-value">#(task.h5Type()??"有H5页面")</div>
                    </li>
                    
                    
                    
                    #if(isShowQrCode.result && isShowQrCode.type=="QRCODE_TOPAY")
                    <li class="m-task-cell">
                        <div class="u-task-key">任务付款:</div>
                        <div class="u-task-value">
                        	<a href="javascript:;" id="showPayCode" style="color:red;font-size:12px">[点我生成付款码信息]</a>
                        </div>
                    </li>
                    #end
                    
                    #if(isShowQrCode.type=="TASK_OFFLINE")
                    <li class="m-task-cell">
                        <div class="u-task-key">任务付款:</div>
                        <div class="u-task-value">
                        	<a href="javascript:;" id="showOffline" style="color:red;font-size:12px">[点我查看付款信息]</a>
                        </div>
                    </li>
                    #end
                    
                    #if(isShowQrCode.type=="ENOUGH_TOPAY")
                    <li class="m-task-cell">
                        <div class="u-task-key">任务付款:</div>
                        <div class="u-task-value">
                        	<a href="javascript:;" id="showEnoughPay" style="color:red;font-size:12px">[点我查看付款信息]</a>
                        </div>
                    </li>
                    #end
                    <!--<li class="m-task-cell">-->
                        <!--<div class="u-task-key">任务标题:</div>-->
                        <!--<div class="u-task-value">xxxxxxxxxxxxxxxxxxxxx</div>-->
                    <!--</li>-->
                </ul>
                #if(fairs!=null && fairs.size()>0)
                <div class="u-title" style="margin-top: 30px;">已选主播</div>
                <ul class="m-head-list">
                    #for(fair : fairs)
                    	<li style='width:110px'>
                    		<a href="/h5/whAdMsg/Personinfo.html?callbacl_pos=#(fair.id)" target="_blank">
                    		<div style="margin:10px;text-align:center">
                    			<div class="avatar" style='background: url("#(fair.photo)??") center/cover no-repeat;''></div>
                    			<div style="margin-top:5px;font;font-weight: bold">#(fair.nick_name??"")</div>
                    		</div>
                    		</a>
                    	</li>
                    #end
                </ul>
                #end
              #else
              	<ul class="m-task-list">
              		<li class="m-task-cell">
                        <div class="u-task-key">任务内容描述:</div>
                        <div class="u-task-value">#(task.task_description)</div>
                    </li>
              	</ul>
              #end
              <div id="editTask" style="margin-top:20px;text-align:center;cursor:pointer;width:200px;border-radius:5px;padding:5px;background-color:#00CC99;color:white;">编辑任务信息</div>
            </div>
        </div>
        #if(isShowQrCode.type!="TASK_OFFLINE")
        <div class="g-task-success-page">
            <div class="m-page-box">
                <div class="u-page">
                    <iframe class="u-page-inner" src="#(contextPath)/platform/mission?id=#(task.id)"></iframe>
                </div>
                <div class="u-icon"></div>
            </div>
        </div>
    	#end
    </div>
</div>

#if(isShowQrCode.result && isShowQrCode.type=="QRCODE_TOPAY")
<input type="hidden" value="任务《#(task.task_title??'')》付款" id="featrue">
<div id="payCode"  style="width:450px;text-align: center; display:none">
	<a href="#payCode" class="fancybox" id="payCodeTrigger" style="display:none">付款码</a>
	<p style="color:red">任务发布微信付款码</p>
	<div id="qrcode"></div>
	<p style="color:grey">打开微信客户端扫二维码付款</p>
	<p style="color:red" id="result">等待付款...</p>
</div>
#end

#if(isShowQrCode.type=="TASK_OFFLINE1")
<div id="offline"  style="width:450px;text-align: center; display:none">
	<a href="#offline" class="fancybox" id="offlineTrigger" style="display:none">付款码</a>
	<p style="color:red">线下任务发布支付信息</p>
	<div>
		<p style="font-weight:bold">开户名:杭州铂数网络技术有限公司</p>
		<p style="font-weight:bold">开户行:中国农业银行杭州市滨江支行</p>
		<p style="font-weight:bold">银行帐号:19045101040044425</p>
		<p style="font-weight:bold">联系电话：0571-81396102</p>
	</div>
	<p style="color:grey">当前任务为线下任务，请按照以上信息进行支付任务金转账操作</p>
</div>
#end


#if(isShowQrCode.type=="ENOUGH_TOPAY")
<div id="enoughPay"  style="width:450px;text-align: center; display:none">
	<a href="#enoughPay" class="fancybox" id="enoughPayTrigger" style="display:none">付款码</a>
	<p style="color:red">余额支付信息</p>
	<div>
		<p style="font-weight:bold">本次任务花费:￥#(isShowQrCode.cost)</p>
		<p style="font-weight:bold">当前余额:#(isShowQrCode.salary)</p>
		<div id="salaryPay" style="cursor:pointer;width:200px;border-radius:5px;padding:5px;background-color:#00CC99;color:white;margin:5px auto">使用账户余额支付</div>
	</div>
	<p style="color:grey">您正在当前使用账户余额支付任务金，请您知晓</p>
	<input id="orderId" value="" type="hidden">
</div>
#end


#end
#define script()
<script type="text/javascript" src="#(contextPath)/assets/admin/js/fancybox/lib/jquery-1.8.2.min.js"></script>
<script src="#(contextPath)/assets/front/web/script/pay/jquery.qrcode.js"></script>
<script type="text/javascript" src="#(contextPath)/assets/admin/js/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="#(contextPath)/assets/admin/js/fancybox/source/jquery.fancybox.js?v=2.1.3"></script>

<script>
$(document).ready(function(){
	$("#editTask").on('click',function(){
		window.location.href="#(contextPath)/platform/task/editTask?id=#(task.id??0)"
	})
	
});
</script>

#if(isShowQrCode.type=="TASK_OFFLINE")
<script>
$(document).ready(function(){
	$('.fancybox').fancybox();
	$("#offlineTrigger").trigger("click");
	$("#showOffline").on('click',function(){
		$("#offlineTrigger").trigger("click");
	})
});
</script>
#end

#if(isShowQrCode.type=="ENOUGH_TOPAY")
<script>
$(document).ready(function(){
	$('.fancybox').fancybox();
	$("#enoughPayTrigger").trigger("click");
	$.ajax({
        type:"POST",
        url:"#(contextPath)/pay/createSalaryPayOrder",
        data:{'id':#(task.id??'')},
        datatype: "JSON",
        success:function(resp){
        		if(resp.result===true){
        			$("#orderId").val(resp.data);
	        	}else{
	        		if(resp.msg!="HAS_PAY"){
	        			layer.alert(resp.msg);
	        		}
	        	}
        	}
        });
	
	$("#showEnoughPay").on('click',function(){
		$("#enoughPayTrigger").trigger("click");
	})
	$("#salaryPay").on('click',function(){
		layer.confirm("确定需要使用当前账户余额进行支付吗？", {
            btn: ['确定支付','放弃支付'] //按钮
        }, function(){
        	$.ajax({
    	        type:"POST",
    	        url:"#(contextPath)/pay/salaryPay",
    	        data:{'id':$("#orderId").val(),taskId:#(task.id??'')},
    	        datatype: "JSON",
    	        success:function(resp){
    	        	if(resp.result===true){
    	        		layer.closeAll('dialog');
    	        		$('#salaryPay').unbind("click");
    	        		$("#salaryPay").html(resp.msg);
    	        	}else{
    	        		
    	        		layer.alert(resp.msg);
    	        	}
    	        	}
    	        });
        });
	});
});
</script>
#end


### 假如为线上推广,则直接出现付款

#if(isShowQrCode.result && isShowQrCode.type=="QRCODE_TOPAY")
<script type="text/javascript">
var ref="";
function queryOrderStatus(id){
	
	$.ajax({
        type:"POST",
        url:"/pay/queryOrderStatus",
        data:{"id":id},
        datatype: "JSON",
        success:function(data){
        	if(data.result){
        		$("#result").html(data.msg+",3秒后为你刷新页面");
        		clearInterval(ref);
        		window.setTimeout("window.location.reload()",3000);
        		return;
        	}else{
        		      
        	}
        	
        },
	});
}


	$(document).ready(function(){
		$('.fancybox').fancybox();
		$("#showPayCode").click(function(){
			$("#payCodeTrigger").trigger("click");
		});
		$.ajax({
            type:"POST",
            url:"#(contextPath)/pay/missionQrCode",
            data:{'objId':#(task.id??'')},
            datatype: "JSON",
            success:function(data){
            	if(data.result){
            		var id =data.data.id;
            		var url =data.data.qrCodeUrl;
            		$("#payCodeTrigger").trigger("click");
	            	$('#qrcode').html("");
	            	$('#qrcode').qrcode({
	            		width: 150,
	            		height: 150,
	            		text: url
	            	});  
	            	ref = window.setInterval("queryOrderStatus("+id+")",1000); 
            	}else{
            		layer.alert(data.msg);        
            	}
            },
		});
		
	});
</script>
#end

#end